<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 手机 过几秒跳转到 jd.com
    // 电脑  过几秒 跳到 baidu.com

    var flag = navigator.userAgent.includes('Mac') || navigator.userAgent.includes('Window')

    if( flag ) {
      //  电脑
      var time = 3
      setInterval(function() {
        
        console.log('还省下' + time +'秒')
        time -= 1

        if(time === 0) {
          location.href = 'http://www.baidu.com'
        }

      }, 1000)
  
    } else {
      // 手机
      var time = 3
      
      setInterval(function() {
        if(time === 0) {
          location.href = 'http://www.jd.com'
        }
        console.log('还省下' + time +'秒')
        time -= 1
      }, 1000)
    }
  </script>
</body>
</html>